package entity;

import java.util.Date;

public class Item {
    private int itemId;
    private int userId;
    private String name;
    private double price;
    private String category;
    private String description;
    private int usageMonths;
    private String condition;
    private Date publishDate;
    private String status;

    // 构造方法
    public Item() {}

    public Item(int userId, String name, double price, String category,
                String description, int usageMonths, String condition) {
        this.userId = userId;
        this.name = name;
        this.price = price;
        this.category = category;
        this.description = description;
        this.usageMonths = usageMonths;
        this.condition = condition;
        this.publishDate = new Date();
        this.status = "在售";
    }

    // Getter和Setter方法
    public int getItemId() { return itemId; }
    public void setItemId(int itemId) { this.itemId = itemId; }

    public int getUserId() { return userId; }
    public void setUserId(int userId) { this.userId = userId; }

    public String getName() { return name; }
    public void setName(String name) { this.name = name; }

    public double getPrice() { return price; }
    public void setPrice(double price) { this.price = price; }

    public String getCategory() { return category; }
    public void setCategory(String category) { this.category = category; }

    public String getDescription() { return description; }
    public void setDescription(String description) { this.description = description; }

    public int getUsageMonths() { return usageMonths; }
    public void setUsageMonths(int usageMonths) { this.usageMonths = usageMonths; }

    public String getCondition() { return condition; }
    public void setCondition(String condition) { this.condition = condition; }

    public Date getPublishDate() { return publishDate; }
    public void setPublishDate(Date publishDate) { this.publishDate = publishDate; }

    public String getStatus() { return status; }
    public void setStatus(String status) { this.status = status; }

    public void displayDetails() {
        System.out.println("=== 商品详情 ===");
        System.out.println("商品ID: " + itemId);
        System.out.println("名称: " + name);
        System.out.println("价格: ¥" + price);
        System.out.println("分类: " + category);
        System.out.println("描述: " + description);
        System.out.println("使用时间: " + usageMonths + "个月");
        System.out.println("状况: " + condition);
        System.out.println("发布时间: " + publishDate);
        System.out.println("状态: " + status);
    }
}